// 定义父类
class Father {
  constructor (name, age) {
    this.name = name
    this.age = age
  }

  sayHello () {
    console.log(`姓名:${this.name}\n年龄:${this.age}`);
  }
}


// 定义子类
class Sub extends Father {
  constructor (name, age, score) {
    // 调用父类构造函数初始化子类实例
    super(name, age)
    this.score = score
  }

  study () {
    console.log(`It's to hard!`);
  }
}

let s2 = new Sub('kennys', 22, 95)
s2.sayHello()
s2.study()
